package LoginSystem.Login;


import ChatSystem.ClientDemo.frame.ClientSetPost;
import ChatSystem.ServerDemo.frame.ServerSetPost;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
 * 创建或加入房间
 * @create 2022.5.29
 * @author Administrator
 *
 */
public class CentreFrame {
    public CentreFrame() {
        JFrame jf1 = new JFrame();
        jf1.setBounds(400,500,400,200);
        JPanel jp1 = new JPanel();
        jp1.setSize(jf1.getWidth(),jf1.getHeight());

        jp1.setLayout(new FlowLayout(1));

        JButton createRoom = new JButton("创建房间");
        JButton joinRoom = new JButton("加入房间");

        createRoom.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new ServerSetPost();
                jf1.setVisible(false);

            }
        });

        joinRoom.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new ClientSetPost();
                jf1.setVisible(false);
            }
        });

        jp1.add(createRoom);
        jp1.add(joinRoom);
        jf1.add(jp1);



        jf1.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        jf1.setVisible(true);
    }


}
